package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbBrandMapper;
import com.dongdongshop.pojo.TbBrand;
import com.dongdongshop.service.TbBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@com.alibaba.dubbo.config.annotation.Service //暴露接口 相当于我们的<bean>标签
public class TbBrandServiceImpl implements TbBrandService {
    @Autowired
    private TbBrandMapper tbBrandMapper;
    @Override
    public List<TbBrand> findAll() {
        List<TbBrand> tbBrands = tbBrandMapper.selectByExample(null);
        return tbBrands;
    }

    @Override
    public Boolean addAll(TbBrand tbBrand) {
        int i = tbBrandMapper.insertSelective(tbBrand);
        return i>0;
    }

    @Override
    public TbBrand selectBrandById(Integer id) {
        TbBrand tbBrand = tbBrandMapper.selectByPrimaryKey(id.longValue());
        return tbBrand;
    }

    @Override
    public Boolean updateAll(TbBrand tbBrand) {
        int i = tbBrandMapper.updateByPrimaryKey(tbBrand);
        return i>0;
    }
    //批量删除
    @Override
    public Boolean deleteBath(Integer[] ids) {
        int i =  tbBrandMapper.deleteBath(ids);
        return i>0;
    }
}
